Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Commit 02ddb37bb1370bcde9ab732feeafdfbea9f5fb56


Parents : bdc6c00
Author : Ivan <ivan@quad4.io>
Signature : Signature validation error
Date : 2026-04-22T16:22:31-05:00

feat(electron): add script to manage temporary directory for Electron Forge builds

Changes

1 files changed, 32 insertions(+), 0 deletions(-)


Diff

diff --git a/scripts/electron-forge-local-tmp.js b/scripts/electron-forge-local-tmp.js
new file mode 100644
index 00000000..c375c27d
--- /dev/null
+++ b/scripts/electron-forge-local-tmp.js
@@ -0,0 +1,32 @@
+#!/usr/bin/env node
+
+// Staging must live outside the repo: packager copies the project into TMPDIR, which cannot be under the source tree.
+
+const { spawnSync } = require("child_process");
+const fs = require("fs");
+const path = require("path");
+
+const root = path.join(__dirname, "..");
+const defaultTmpDir = path.join(path.dirname(root), `.forge-tmp-${path.basename(root)}`);
+const tmpDir = path.resolve(process.env.FORGE_TMPDIR || defaultTmpDir);
+fs.mkdirSync(tmpDir, { recursive: true });
+
+const env = {
+ ...process.env,
+ TMPDIR: tmpDir,
+ TEMP: tmpDir,
+ TMP: tmpDir,
+};
+
+const forgeCli = require.resolve("@electron-forge/cli/dist/electron-forge.js");
+const args = process.argv.slice(2);
+const result = spawnSync(process.execPath, [forgeCli, ...args], {
+ cwd: root,
+ env,
+ stdio: "inherit",
+});
+
+if (result.signal) {
+ process.exit(1);
+}
+process.exit(result.status ?? 1);


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────